#ifndef AVALON_SERVICEENTRY_HPP
#define AVALON_SERVICEENTRY_HPP
#include <string>
#include "Avalon/Serialization/Serialization.hpp"
#include "Avalon/ServiceLocator/DirectoryEntry.hpp"
#include "Avalon/ServiceLocator/ServiceLocator.hpp"

namespace Avalon {
namespace ServiceLocator {

  /*! \class ServiceEntry
   *  \brief Stores information about a service.
   */
  class ServiceEntry {
    public:

      //! Constructs an empty ServiceEntry.
      ServiceEntry();

      //! Constructs a ServiceEntry.
      /*!
        \param name The name of the service.
        \param details Details about the service.
        \param id The unique id assigned to the service.
        \param account The Account providing the service.
      */
      ServiceEntry(const std::string& name, const std::string& details,
        int id, const DirectoryEntry::Tag& account);

      //! Returns the name of the service.
      const std::string& GetName() const;

      //! Returns the service details.
      const std::string& GetDetails() const;

      //! Returns the service id.
      int GetId() const;

      //! Returns the Account providing the service.
      const DirectoryEntry::Tag& GetAccount() const;

      //! Tests for equality.
      /*!
        \param lhs The left hand side of the test.
        \return <code>true</code> iff <i>lhs</i> has the same id as <i>this</i>.
      */
      bool operator ==(const ServiceEntry& lhs) const;

      //! Tests for inequality.
      /*!
        \param lhs The left hand side of the test.
        \return <code>true</code> iff <i>lhs</i> does not have the same id as
                <i>this</i>.
      */
      bool operator !=(const ServiceEntry& lhs) const;

    private:
      friend class Serialization::DataShuttle;
      std::string m_name;
      std::string m_details;
      int m_id;
      DirectoryEntry::Tag m_account;

      void Shuttle(Serialization::DataShuttle* shuttle, unsigned int version);
  };
}
}

#endif // AVALON_SERVICEENTRY_HPP
